
package com.swak.frame.filter.annotation;

import com.swak.frame.dto.base.BaseOperation;

/**
 * @ClassName: ApiFilterOperation.java
 * @author: colley.ma
 * @date: 2022/02/16
 */
public class ApiFilterOperation implements BaseOperation {
    private static final long serialVersionUID = -8663031715419784133L;

    private String resource;

    private SwakMethod swakMethod;

    public ApiFilterOperation() {}

    public static ApiFilterOperation newOperation(String resource, SwakMethod swakMethod) {
        ApiFilterOperation operation = new ApiFilterOperation();
        operation.setResource(resource);
        operation.setSwakMethod(swakMethod);
        return operation;
    }

    public String getResource() {
        return resource;
    }

    public void setResource(String resource) {
        this.resource = resource;
    }

    public SwakMethod getSwakMethod() {
        return swakMethod;
    }

    public void setSwakMethod(SwakMethod swakMethod) {
        this.swakMethod = swakMethod;
    }

    public static class Builder {
        private String resource;
        private SwakMethod swakMethod;

        public Builder resource(String resource) {
            this.resource = resource;
            return this;
        }

        public Builder swakMethod(SwakMethod swakMethod) {
            this.swakMethod = swakMethod;
            return this;
        }

        public ApiFilterOperation build() {
            return new ApiFilterOperation(this);
        }
    }

    private ApiFilterOperation(Builder builder) {
        this.resource = builder.resource;
        this.swakMethod = builder.swakMethod;
    }
}
